package br.com.mynage.dominio;



import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Elaine
 */
@Entity
@Table(name = "recado")
@NamedQueries({
    @NamedQuery(name = "Recado.findAll", query = "SELECT r FROM Recado r"),
    @NamedQuery(name = "Recado.findById", query = "SELECT r FROM Recado r WHERE r.id = :id")})
public class Recado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 2147483647)
    @Column(name = "recado")
    private String recado;
    @JoinColumn(name = "id_usuario_destino", referencedColumnName = "id")
    @ManyToOne(optional = false)
    //@ManyToOne(mappedBy = "usuario", fetch=FetchType.LAZY)
    private Usuario idUsuarioDestino;
    @JoinColumn(name = "id_usuario_origem", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Usuario idUsuarioOrigem;

    public Recado() {
    }

    public Recado(Integer id) {
        this.id = id;
    }

    public Recado(Integer id, String recado) {
        this.id = id;
        this.recado = recado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRecado() {
        return recado;
    }

    public void setRecado(String recado) {
        this.recado = recado;
    }

    public Usuario getIdUsuarioDestino() {
        return idUsuarioDestino;
    }

    public void setIdUsuarioDestino(Usuario idUsuarioDestino) {
        this.idUsuarioDestino = idUsuarioDestino;
    }

    public Usuario getIdUsuarioOrigem() {
        return idUsuarioOrigem;
    }

    public void setIdUsuarioOrigem(Usuario idUsuarioOrigem) {
        this.idUsuarioOrigem = idUsuarioOrigem;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Recado)) {
            return false;
        }
        Recado other = (Recado) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Recado[ id=" + id + " ]";
    }
    
}
